#ifndef GAMESERVER_H
#define GAMESERVER_H

#include <string>
#include <list>

class SocketData;
class Socket
{
public:
    Socket(); // not implemented
    virtual ~Socket();
    bool connectToServer(const std::string &host, int port); // not implemented
    virtual void dataAvailable() {}

    std::string server() const;
    int port() const;

    void sendPacket(const char *data, int size);
    int receivePacket(char *buffer, int maxSize, int timeout = 0);
    int packetSize() const; // make this cache packetSize. It's either this or some putch mechanism
protected:
    int bytesAvailable() const; // not implemented
    bool waitForBytesAvailable(int bytes, int timeout); // not implemented
    int read(char *buffer, int max); // not implemented
    int write(const char *data, int size); // not implemented
private:
    SocketData *data;
};

class ServerData;
class Server
{
public:
    Server(); // not implemented
    virtual ~Server();
    bool hasPendingConnections(); // not implemented
    Socket *socketNextPending(); // not implemented
    const std::list<Socket*> &connections() const;
    void closeConnection(Socket *connection); // not implemented
    bool listen(const std::string &address, int port = 0); // not implemented
protected:
    virtual void incomingConnection() {}
private:
    ServerData *data;
};


#endif
